package com.cup.bddm.api.controller;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cup.bddm.api.req.UserVo;
import com.cup.bddm.api.res.ResVo;
import com.cup.bddm.config.Config;
import com.cup.bddm.handler.Token;

@Token
@Controller
@RequestMapping(value = "/api/user/log", method = RequestMethod.POST)
public class UserLogController extends BaseController {
	static Logger logger = Logger.getLogger(UserLogController.class);

	@RequestMapping(value = "/find")
	@ResponseBody
	public ResVo find(@RequestBody UserVo vo) {
//		if (invalidToken(vo)) {
//			return the().token_err(token_err).vo();
//		}
		if (!Config.CUP_INS_ID.equals(vo.getCup_branch_ins_id_cd()) && !vo.getCup_branch_ins_id_cd().equals(user().getCup_branch_ins_id_cd())) {
			return the().cup_branch_ins_id_cd().is_invalid().vo();
		}
		return ResVo.data(userLogService.findByVo(vo));
	}
}
